package cn.ruituo.adv4;
import java.io.*;
import java.util.Date;

public class FileInform {
    public static void main(String[] args) {
        //路径
        File f=new File("C:\\Windows\\System32");
        System.out.println(f.getName());
        System.out.println(f.getAbsolutePath());
        System.out.println("是否存在？"+f.exists());
        if(!f.exists())
            return;

        System.out.println("是不是文件夹? "+f.isDirectory());
        System.out.println("是不是文件？"+f.isFile());
        System.out.println("大小："+f.length());
        System.out.println("最后修改时间："+new Date(f.lastModified()));
        System.out.println("read?"+f.canRead());
        System.out.println("write?"+f.canWrite());
        System.out.println("执行?"+f.canExecute());
    }
}
